Subject: Re: Systemtime
From: "Rand R. Fredricksen" <[email-masked]>
To: * AMOS Mailing List * <[email-masked]>
Date: 02 Mar 97 17:05:38 +0500

Reine Johansson digitized on 03-Mar-97 00:08:57:
 RJ> How do I get the systemtime in AMOS? Example code _please_

In AmosPRO you can call these procedures:

'******************************************************* 
'*                                                     * 
'* AMOS Professional Procedure Library                 * 
'*                                                     * 
'* Procedure: Date and Time                            *   
'*                                                     * 
'*    Author: Francois Lionet                          *   
'*                                                     * 
'******************************************************* 
'
_DATE$ : Print Param$
_TIME$ : Print Param$
'
Procedure _DATE$
   '
   ' Call DOS DateStamp function
   T$=Space$(12)
   Dreg(1)=Varptr(T$)
   RIEN=Doscall(-192)
   NJ=Leek(Varptr(T$))
   '
   ' Find this year's first day 
   A=1978 : JOUR=7
   Do 
      BIS=0 : If(A and 3)=0 : BIS=1 : End If 
      Exit If NJ-365-BIS<0
      Add JOUR,1+BIS : If JOUR>7 : Add JOUR,-7 : End If 
      Add NJ,-365-BIS
      Inc A
   Loop 
   '
   ' Find month 
   M=1
   Do 
      Read N
      Exit If NJ-N<0
      Add NJ,-N : Inc M
   Loop 
   Inc NJ
   '
   ' Fabrique la chaine 
      J$=Mid$(Str$(NJ),2) : If Len(J$)<2 : J$="0"+J$ : End If 
      M$=Mid$(Str$(M),2) : If Len(M$)<2 : M$="0"+M$ : End If 
      A$=Mid$(Str$(A),2)
      DATE$=J$+"-"+M$+"-"+A$
   '
   ' Length of each month 
   Data 31,28+BIS,31,30,31,30,31,31,30,31,30,31
   '
End Proc[DATE$]
Procedure _TIME$
   '
   ' Call DOS function
   T$=Space$(12)
   Dreg(1)=Varptr(T$)
   RIEN=Doscall(-192)
   MN=Leek(Varptr(T$)+4)
   SEC=Leek(Varptr(T$)+8)
   '
   ' Minutes calculation
   H=MN/60 : H$=Mid$(Str$(H),2) : If Len(H$)<2 : H$="0"+H$ : End If 
   M=MN mod 60 : M$=Mid$(Str$(M),2) : If Len(M$)<2 : M$="0"+M$ : End If 
   '
   ' Seconds calculation  
   S=SEC/50 : S$=Mid$(Str$(S),2) : If Len(S$)<2 : S$="0"+S$ : End If 
   '
   ' Final string 
   TIME$=H$+":"+M$+":"+S$
   '
End Proc[TIME$]

Hope this helps.
- Rand

--
[email-masked]   ////
Rand R. Fredricksen    //// 
Wheeling IL  USA  \\\\////  
                   \\\///